package com.bitjsc.server.data;



public class Card
{
	// card figure : S (spades), H (hearts), D (diamonds), C(clubs)
	String cardFigure = null;
	// card name (A = 1, J = 11, Q = 12, K = 13)
    int cardName = 0;
	//check if a card is taken
    Boolean isTaken = false;
    
    //constructor 
    public Card(int cardName,String cardFigure)
    {
    	this.cardName = cardName;
    	this.cardFigure = cardFigure;
    	this.isTaken = false;
    }
    
    //create some methods
    // set - get card name
    public void setCardName(int cardName) throws Exception
	{
    	if(cardName<1 || cardName>13)
    	{
    		throw new Exception("Invalid card name...");
    	}
    	else 
    	{
    		this.cardName = cardName;
		}
		
	}
    
    public int getCardName()
	{
		return this.cardName;
	}
    
    // set - get card figure
    public void setCardFigure(String cardFigure) throws Exception
	{
    	if(cardFigure.equalsIgnoreCase("s")||cardFigure.equalsIgnoreCase("h")||cardFigure.equalsIgnoreCase("d")||cardFigure.equalsIgnoreCase("c"))
		{
    		this.cardFigure = cardFigure;
		}
    	else 
    	{
    		throw new Exception("Invalid card figure...");
    	}
    	
	}
    
    public String getCardFigure()
    {
    	return cardFigure;
    }
    
    // set - get taken card
    public void setTakenCard(Boolean isTaken)
	{
		this.isTaken = isTaken;
	}
    
    public Boolean getTakenCard()
	{
		return isTaken;
	}   
    
    @Override
    public String toString()
    {
    	return this.getCardName() + " " + this.getCardFigure();
    }
    
    
}

